package com.hengmei.smallscreen.adapter;

import android.text.TextUtils;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatButton;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.hengmei.smallscreen.R;
import com.hengmei.smallscreen.wifimanager.IWifi;

import java.util.List;


public class WifiAdapter extends BaseQuickAdapter<IWifi, BaseViewHolder> {

    public WifiAdapter(int layoutResId, @Nullable List<IWifi> data) {
        super(layoutResId, data);
    }


    @Override
    protected void convert(@NonNull BaseViewHolder holder, IWifi item) {

        AppCompatButton tv = holder.getView(R.id.select_test);
        holder.setText(R.id.select_title,item.name());
        if(item.isConnected()){

            holder.setText(R.id.select_test,getContext().getResources().getString(R.string.breakWifi));
            tv.setTextColor(getContext().getResources().getColor(R.color.colorTextRed));
        }else{
            tv.setTextColor(getContext().getResources().getColor(R.color.white));
            holder.setText(R.id.select_test,getContext().getResources().getString(R.string.connect));
//
        }
        if(!TextUtils.isEmpty(item.state())){
            holder.setText(R.id.     value_text,item.state());

        }else{
            holder.setText(R.id.     value_text,"");

        }



//        holder.setText(R.id.value_text,item.getWaveLength());
//        holder.setText(R.id.select_test,item.getStatusText());
    }


}
